package com.iman.locker.view.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;


import com.iman.locker.R;
import com.iman.locker.model.AppInfo;

import java.util.List;

/**
 * 应用列表适配器
 * Created by esirong on 2015/11/9.
 */
public class AppInfoAdapter extends ChoiceListAdapter<AppInfo> {

    public AppInfoAdapter(Context context,  List<AppInfo> data) {
        this(context, R.layout.item_app_info, data, R.id.checkedView);

    }

    public AppInfoAdapter(Context context, int layoutId, List<AppInfo> data, int... choiceId) {
        super(context, layoutId, data, choiceId);
    }

    @Override
    protected void holdView(ChoiceLayout view) {
        view.hold(R.id.tv_item_title);
        view.hold(R.id.iv_item_icon);

    }

    @Override
    protected void bindData(ChoiceLayout view, int position, AppInfo data) {
        TextView text = view.get(R.id.tv_item_title);
        text.setText(data.label);
        ImageView imageView = view.get(R.id.iv_item_icon);
        imageView.setImageDrawable(data.icon);
    }
}
